<?php
namespace app\erp_meixingtiyu\model;

use think\Model;
use think\model\concern\SoftDelete;
use app\common\model\UploadFile;

class MemberCard extends Model
{
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $table = 'athlon_membercard';
    protected $pk = 'nid';

    public function image()
    {
        return $this->hasOne(UploadFile::class, 'file_id', 'image_id');
    }

    public function getList()
    {
        return $this->with('image')
            ->order(['sort' => 'asc', 'nid' => 'asc'])
            ->paginate(15);
    }

    public static function add($data)
    {
        return self::create($data);
    }

    public static function edit($params)
    {
        return self::update($params);
    }
}
